package driver.nxt.events;

import icommand.nxt.Battery;
import driver.events.BatteryEvent;
import driver.exceptions.SensorException;

/**
 * Provides capabilities for reading the current battery level of the NXT
 *
 * @author David Martin
 */
public class NXTBatteryEvent extends BatteryEvent
{

  public NXTBatteryEvent()
  {
    super();
  }

  /**
   * Reads the current level of the battery, measured in millivolts out of
   * 9000mV (9V)
   *
   * @return the current battery level in millivolts
   */
  public String readFromSensor() throws SensorException
  {
    return String.valueOf(Battery.getVoltageMilliVolt());
  }

  /**
   * Gets the maximum battery level in millivolts (usually 9000mV for the NXT)
   *
   * @return the max battery level in millivolts
   */
  public int getMaxReading()
  {
    return 9000;
  }

  public String getMeasurementUnits()
  {
    return "MilliVolts";
  }
}

